'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 支付记录
 * @author sundbcn@gmail.com (sun debing)
 */

var moment = require('moment');
var mongoose = require('mongoose');
var autoIncrement = require('mongoose-auto-increment');

/**
 * 支付记录
 */
var payRecordSchema = new mongoose.Schema({
    // 角色id
    role_id: {
        type: Number,
        required: true
    },

    // 订单id
    order_id: {
        type: String,
        required: true
    },

    // 商品id
    product_id: {
        type: Number,
        required: true
    },

    // 金额
    amount: {
        type: Number,
        required: true
    },

    // 创建时间
    create_time: {
        type: Date,
        default: Date.now
    },

    // 充值的数据
    data: {
        type: mongoose.Schema.Types.Mixed
    },
});

if (!payRecordSchema.options.toJSON) {
    payRecordSchema.options.toJSON = {};
}
/* jshint unused:false */
payRecordSchema.options.toJSON.transform = function (doc, ret) {
    delete ret._id;
    delete ret.__v;
};

mongoose.model('PayRecord', payRecordSchema);
